package patterndesign.factory;

/**
 * @Description
 * @Date 2021/9/18
 * @Created by Jonathan
 */
public class HumanFactory extends AbstractHumanFactory {
    @Override
    public <T extends Human> T createHuman(Class<T> c) {
        Human human = null;

        try {
            human = (T) Class.forName(c.getName()).newInstance();
        } catch (Exception e) {
            System.out.println("人种生成发生错误。");
        }
        return (T) human;
    }
}
